package com;

import cnn.User1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * User1这个类不在com扫描范围内，要想注入，必须使用EnableConfigurationProperties
 * 对比类：com.EnableUser2ScanController
 */
@RestController
@EnableConfigurationProperties(User1.class)
public class EnableUser1NotScanController {
    @Autowired
    private User1 user1;

    @RequestMapping("user1")
    public int user1() {
        return this.user1.getAge();
    }
}
